<template>
  <div id="box">
    <div id="zhong">
      <div id="a" v-for="book in books" :key="book.id">
        <div id="a1">
          <img :src="book.img" alt />
        </div>
        <div id="sss">
          <div id="a4">{{book.name}}</div>
          <div id="a2">
            <div id="a22">
              <img :src="book.xiaoimg" v-if="book.xiaoimg" />
            </div>
            <div id="a23" :style="book.back">{{book.author}}</div>
          </div>
          <div id="a3">
            <div id="a33">￥{{book.price}}</div>
            <div id="a34">{{book.type}}</div>
          </div>
          <div id="a5">立即抢购</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

import getlink from "../../../../api/apiserver"
export default {
data(){
    return{
        id:0,
        books:[]
    }
},
mounted(){
    getlink("http://localhost:3000/lunbotu").then((ok)=>{
        this.books=ok.data
        this.books.splice(0,4)
    })
    
}
};
</script>

<style scoped>
#box {
  width: 100%;
}
#zhong {
  width: 95%;
  display: flex;
flex-wrap: wrap;
  margin: auto;
  justify-content: space-between;
}
#a {
  width: 1.9rem;
  height: 2.84rem;
  background-color: aliceblue;
  border-radius: 0.2rem;
  margin-bottom: 0.1rem;
}
#a1 {
  width: 100%;
  height: 1.72rem;
  border-radius: 0.2rem 0.2rem 0 0;
}
#a1 img {
  width: 100%;
  height: 100%;
  border-radius: 0.2rem 0.2rem 0 0;
}
#sss {
  width: 100%;
  height: 1rem;
  padding-left: 0.15rem;
}
#a4 {
  width: 90%;
  height: 0.24rem;
  font-size: 3.7333vw;
  line-height: 0.24rem;
}
#a2 {
  width: 90%;
  height: 0.24rem;
  display: flex;
}
#a22{
    align-self: center;
}
#a22 img {
  width: 0.78rem;
  height: 0.16rem;
}
#a23{
    width: .6rem;
    height: .16rem;
     align-self: center;
     font-size: 2.9333vw;
     text-align: center;
     line-height: .16rem;
}
#a3 {
  width: 90%;
  height: 0.24rem;
  display: flex;
}
#a33 {
  font-size: 4.5333vw;
  color: rgb(242, 29, 29);
}
#a34 {
  font-size: 2.9333vw;
  color: rgb(153, 153, 153);
  margin-left: 0.5333vw;
  margin-top: 1.8vw;
  text-decoration: line-through;
}
#a5 {
  width: 1.54rem;
  height: 0.27rem;
  font-size: 3.7333vw;
  background-color: rgb(242, 29, 29);
  font-weight: 500;
  color: rgb(255, 255, 255);
  margin-left: 0.025rem;
  border-radius: 0.5rem;
  text-align: center;
  line-height: 0.27rem;
}
</style>